


<?php
// Destination folder for downloaded files
$upload_folder = './data';

// If the browser supports sendAsBinary () can use the array $ _FILES
if(count($_FILES)>0) { 
	//if( move_uploaded_file( $_FILES['upload']['tmp_name'] , $upload_folder.'/'.$_FILES['upload']['name'] ) ) {
	//	echo 'done';
	//}
	exit();
} else if(isset($_GET['up'])) {
	// If the browser does not support sendAsBinary ()
	if(isset($_GET['base64'])) {
		$content = base64_decode(file_get_contents('php://input'));
	} else {
		$content = file_get_contents('php://input');
	}
	require_once '../phpExcelReader/Bank/generic_banc.php';
  require_once '../phpExcelReader/Bank/buxfer.php';
	
   $account = $_GET['account'];	

   $importClass = $_GET['importclass'];	
    $o_bank_res = new $importClass($content);
    
    $o_bank_res->read_content();
    $o_transaction = $o_bank_res->get_transaction();
    session_start();
    $o_buxfer = new buxfer($_SESSION['username'],$_SESSION['password']);
    $o_buxfer->set_account($account);
    for ($i = 0; $i < count($o_transaction); $i++) {
         $o_buxfer->compare($o_transaction[$i]);
    }
    $o_buxfer->add_transactions();     
    }
?>